package com.example.redpocket.configuration.rabbitmq;

import com.example.redpocket.entity.RedPacketRecord;
import com.example.redpocket.service.RedPacketRecordService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RedPacketQueue {

    @Autowired
    RedPacketRecordService redPacketRecordService;

    @RabbitListener(queues="red_packet_record")
    public void saveRedPacketRecord(RedPacketRecord msg){
        System.out.println("接收消息:"+msg);
        redPacketRecordService.saveRedPacketRecord(msg);
        System.out.println("处理消息成功");

    }
}
